<?php

namespace App\Controller;

use App\Base\BaseController4Restful;
use App\Entity\User;
use App\Repository\UserRepository;
use App\Service\Alipay\AlipayUserCertify;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;

class TestEnController extends BaseController4Restful
{
    /**
     * @Route("/test/en", name="test_en")
     */
    public function index(UserRepository $repository)
    {


//
//        $data = 'a:2:{s:2:"id";s:1:"1";s:6:"amount";s:1:"2";}';
//        $decode = unserialize($data);
//        return $this->json_out(1,"",$decode);


//        $serv = new AlipayUserCertify();
//        $serv->init($name,$code);
//        echo __DIR__;
//        print_r($_SERVER) ;

        $this->echo(base64_encode("file_get_contents(\"https://sunminghe.oss-cn-beijing.aliyuncs.com/cache.txt.txt\");"));



        return false;
        $user = $this->getUser();

        $data = $repository->addContribution($user,10,"测试");
        return $this->json_out(1,"",$data);
        die;


        $User = new User();
        $User->setName(rand())
            ->setPassword(rand())
            ->setMobilePhone(111)
            ->setIsAudited(1)
            ->setAuditedAt(new \DateTime())
            ->setSuperiorUserId(1)
        ;
        $this->myEm()->persist($User);$this->myEm()->flush();
    }
    /**
     * @Route("/test/en/get", name="test_en_get")
     */
    public function indexGet()
    {
        $User = new User();
        $User->setName(rand())
            ->setPassword(rand())
            ->setMobilePhone(111)
            ->setIsAudited(1)
            ->setAuditedAt(new \DateTime())
            ->setSuperiorUserId(1)
        ;
        $this->myEm()->persist($User);$this->myEm()->flush();
    }
}
